<div class="app_form">
    <?php echo App::Helper('Toolbar')->setTitle("Export Database")->setBtnBack()->Render(array('code'=>'export_database'));?>
    <p><?php echo $this->__("Download Database in a XML formate with SCHEMA and DATA"); ?></p>

    <form method="post" action="<?php echo $this->baseurl("/developer/imexport");?>">
        <input type="submit" class="app_button" value="Export" name="data[ImExport][export]">
    </form>

    <?php echo App::Helper('Toolbar')->setTitle("Import Databse")->setBtnBack()->Render(array('code'=>'export_database'));?>
    <p><?php echo $this->__("For security reason please keep a backup of previous database.");?>
    <br><strong><?php echo $this->__("Important");?></strong>
    <br><?php echo $this->__("Previous data wil be replaced.");?></p>

    <form enctype="multipart/form-data" action="<?php echo $this->baseurl("/developer/imexport");?>" method="POST">
        <p class="message"><?php echo $import_err;?></p>
        <input type="file" value="" name="data[ImExport][filename]">
        <input type="submit" class="app_button" value="Import" name="data[ImExport][import]">
    </form>


    <?php echo App::Helper('Toolbar')->setTitle("Backup Databse")->setBtnBack()->Render(array('code'=>'backup_databse'));?>
    <p class="message"><?php echo $backup_err;?></p>
    <?php if( isset($database_files['file'])): ?>
        <?php foreach ( $database_files['file'] as $val ):?>
                <a href="<?php echo $this->baseurl("/common/download/" . base64_encode(DATA . DS . "database/{$val['name']}"));?>"><em><?php echo $this->__("Download");?></em></a> -
                <a href="<?php echo $this->baseurl("/developer/imexport/delete/" .base64_encode($val['name']));?>"><em><?php echo $this->__("Delete");?></em></a> -
                <?php echo $val['name'];?>
        <?php endforeach;?>
    <?php endif;?>
    <form enctype="multipart/form-data" action="<?php echo $this->baseUrl("/developer/imexport");?>" method="POST">
        <input type="text" size="30" value="<?php echo App::Helper('Date')->getDate('Y-m-d_H-i-s'); ?>" name="data[ImExport][filename]">
        <input type="submit" class="app_button" value="Backup" name="data[ImExport][backup]">
    </form>


    <?php echo App::Helper('Toolbar')->setTitle("Restore Databse")->setBtnBack()->Render(array('code'=>'restore_databse'));?>
    <p class="message"><?php echo $restore_err;?></p>
    <form method="post" action="<?php echo $this->baseurl("/developer/imexport");?>" enctype="multipart/form-data">
    <?php if( isset($database_files['file'])):?>
        <select name="data[ImExport][file_name]">
            <option value=""><?php echo $this->__("Select a version to rollback");?></option>
            <?php foreach ( $database_files['file'] as $key => $val ):?>
                <option  value="<?php echo $val['name'];?>"><?php echo $val['name'];?></option>
            <?php endforeach;?>
        </select>
    <?php endif;?>
    <input type="submit" class="app_button" value="Restore" name="data[ImExport][restore]">
    </form>

    <?php echo App::Helper('Toolbar')->setBtnBack()->Render(array('code'=>'dpexportimport_bottom'));?>
</div>